<?php

namespace app\admin\controller;

use think\Controller;
use buildView\Detail;
use buildView\Form;
use buildView\Grid;
use app\common\model\ShopRecharge;

/**
 * 充值管理
 * Class Recharge
 * @package app\admin\controller
 */
class Recharge extends Controller
{
    /**
     * 列表
     * @auth true
     * @menu true
     * @return string
     */
    public function index()
    {
        $grid = new Grid(new ShopRecharge);
		$grid->column('money','充值金额');
		$grid->column('pay_money','实付金额');
        $grid->column('status', '状态')->width(150)->align('left')->switchs([
            'on' => ['text' => '启用', 'value' => 1],
            'off' => ['text' => '禁用', 'value' => 0],
        ]);
		$grid->column('create_at','添加时间');
		$grid->filter(function ($filter){
            $filter->dateBetween('create_at','添加时间');
        });
        $grid->hideExportButton();
        $grid->actions(function ($action){
        	 $action->hideDetail();
        });
        return $grid->view();
    }

    /**
     * 添加/编辑
     * @auth true
     * @menu true
     * @return string
     */
    public function form()
    {
        $form = new Form(new ShopRecharge);
		$form->number('money','充值金额');
		$form->number('pay_money','实付金额');
        return $form->view();
    }
}
